﻿{% extends "base.html" %}

{% block scripts %}
     <link rel="stylesheet" href="/media/js/chosen/chosen.css">
    <script src="/media/js/chosen/chosen.jquery.js" type="text/javascript"></script>
    <script>
        $(function() {
            $("#id_categories").chosen();
            $("input[type=submit]").attr("disabled", "disabled");
            $('#accept_rules').change(function() {
                var f =  $('#accept_rules').is(':checked');
                if (f)
                    $('input[type=submit]').removeAttr('disabled');
                else
                    $("input[type=submit]").attr("disabled", "disabled");
            });
        });

    </script>
{% endblock %}

{% block content %}
    <h1>Регистрация компании</h1>

    <div class="reg_block">
    <!--<div class="settings_block settings_block_private">-->

        <form class="form" action="/add_company/" method="post">
            <dl>
                {% if form.name.errors %}
                    <dt><p class="error_message">{{ form.name.errors|striptags }}</p></dt>
                {% endif %}
                <dt><label for="id_name">Название компании:</label></dt>
                <dd><input id="id_name" name="name" class="text_input" type="text" value="{{ form.data.name }}"></dd>

                {% if form.activities.errors %}
                    <dt><p class="error_message">{{ form.activities.errors|striptags }}</p></dt>
                {% endif %}
                <dt><label for="id_categories">Сфера деятельности:</label></dt>
                <dd>
                    <select id="id_categories" name="categories" class="text_input" multiple="multiple" data-placeholder="Выберите виды деятельности">
                        {% for category in info.categories %}
                            <option value="{{ category.id }}">{{ category.name }}</option>
                        {% endfor %}
                    </select>
                </dd>

                {% if form.ownership_type.errors %}
                    <dt><p class="error_message">{{ form.ownership_type.errors|striptags }}</p></dt>
                {% endif %}
                <dt><label for="id_ownership_type">Форма собственности:</label></dt>
                <dd><input id="id_ownership_type" name="ownership_type" class="text_input" type="text" value="{{ form.data.ownership_type }}"></dd>

                {% if form.phone.errors %}
                    <dt><p class="error_message">{{ form.phone.errors|striptags }}</p></dt>
                {% endif %}
                <dt><label for="id_phone">Телефон:</label></dt>
                <dd><input id="id_phone" name="phone" class="text_input" type="text" value="{{ form.data.phone }}"></dd>

                {% if form.ur_address.errors %}
                    <dt><p class="error_message">{{ form.ur_address.errors|striptags }}</p></dt>
                {% endif %}
                <dt><label for="id_ur_address">Юридический адрес:</label></dt>
                <dd><input id="id_ur_address" name="ur_address" class="text_input" type="text" value="{{ form.data.ur_address }}"></dd>

                {% if form.fiz_address.errors %}
                    <dt><p class="error_message">{{ form.fiz_address.errors|striptags }}</p></dt>
                {% endif %}
                <dt><label for="id_fiz_address">Физический адрес:</label></dt>
                <dd><input id="id_fiz_address" name="fiz_address" class="text_input" type="text" value="{{ form.data.fiz_address }}"></dd>
            </dl>

            <!--
            <h2 class="block_header">Реквизиты компании</h2>
            <dl>
                <dt><label for="form_reg_company_requisites_1">ИНН:</label></dt>
                <dd><input id="form_reg_company_requisites_1" class="text_input" type="text"></dd>
                <dt><label for="form_reg_company_requisites_2">КПП:</label></dt>
                <dd><input id="form_reg_company_requisites_2" class="text_input" type="text"></dd>
                <dt><label for="form_reg_company_requisites_3">ОГРН:</label></dt>
                <dd><input id="form_reg_company_requisites_3" class="text_input" type="text"></dd>
                <dt><label for="form_reg_company_requisites_4">р/сч:</label></dt>
                <dd><input id="form_reg_company_requisites_4" class="text_input" type="text"></dd>
                <dt><label for="form_reg_company_requisites_5">к/сч:</label></dt>
                <dd><input id="form_reg_company_requisites_5" class="text_input" type="text"></dd>
                <dt><label for="form_reg_company_requisites_6">Наименование банка:</label></dt>
                <dd><input id="form_reg_company_requisites_6" class="text_input" type="text"></dd>
                <dt><label for="form_reg_company_requisites_7">БИК:</label></dt>
                <dd><input id="form_reg_company_requisites_7" class="text_input" type="text"></dd>
            </dl>
            -->

            <div class="for_check"><label for="accept_rules"><input id="accept_rules" class="checkbox" type="checkbox">Согласиться с правилами использования сайта</label></div>

            <div class="buttons"><input class="button" type="submit" value="Зарегистрироваться"></div>
        </form>
    </div>
{% endblock %}